package thread;

import java.util.concurrent.locks.LockSupport;

/**
 * park和unpark的方法介绍。
 */
public class ParkTest {

    public static void main(String[] args) throws InterruptedException {
        Thread t1 =new Thread("t1"){

            @Override
            public void run() {
                //阻塞线程。
                LockSupport.park();

            }
        };
        t1.start();

        Thread.sleep(1000);
        //放行线程。
        LockSupport.unpark(t1);

    }

}
